package com.example.maruko_course_backend.controller;

import com.example.maruko_course_backend.criterias.TranslateCriteria;
import com.example.maruko_course_backend.services.impl.TranslateServiceImpl;
import com.example.maruko_course_backend.vo.TranslateVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/translation")
public class TranslateController {

    @Autowired
    private TranslateServiceImpl translateServiceImpl;

    @PostMapping("/translateVo")
    public TranslateVo getTranslateVo(@RequestBody TranslateCriteria translateCriteria) {
        TranslateVo result = new TranslateVo();
        result.setTranslateDtos(translateServiceImpl.splitAndGetTranslateDtos(translateCriteria.getOriginalStr()));
        return result;
    }
}
